<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<spring:url value="/js/candidato/datigenerali.js" var="jsUrl"></spring:url>
<script src="${jsUrl}" type="text/javascript"></script>
<style>
	.ui-datepicker-trigger { 
		vertical-align:top;
		height:16px;
		width:16px;	
	}
</style>
<div class="unit-row">
	<div class="unit-70" style="width:100%;opacity:0.7;background-color:#FFFFFF;font-weight:bold;">
		<nav class="nav-tabs unit-centered" style="width:1000px">
			<ul>
				<li><span>Dati opportunita</span></li>
<%-- 				<c:if test = "${not empty opportunita.idOpportunita }"> --%>
<%-- 					<li><a href="${flowExecutionUrl}&_eventId=candidati-opportunita">Candidati</a></li>		 --%>
<%-- 				</c:if>			 --%>
				<li><a href="<c:url value="j_spring_security_logout" />">Logout</a></li>
			</ul>
		</nav>
		<br/>
		<c:if test="${not empty datiOpportunitaSalvati}">
			<div class="message message-success">
	    		<span class="close"></span>
	    		Dati salvati con successo per l'opportunit&agrave;:<c:out value="${opportunita.codice}/${opportunita.progressivo}" />
			</div>
		</c:if>
		<c:if test="${not empty requestScope['org.springframework.validation.BindingResult.datiOpportunita'].allErrors}">
		<div class="message message-error">
		    <span class="close"></span>
		    Sono presenti degli errori!
		</div>
		</c:if>
		<form:form id="datiOpportunita" method="post" action="${flowExecutionUrl}"
			commandName="opportunita" cssClass="forms forms-columnar">
			<form:hidden path="idOpportunita"/>
			<c:if test="${opportunita.aziendaToBeDefined == false && opportunita.aziendaNotDefined == false}">
				<form:hidden path="azienda.idAzienda"/>
			</c:if>
			<p class="forms-inline">
				<form:label path="codice" cssErrorClass="error">Codice<em class="req">*</em></form:label>
				<form:select path="codice" cssClass="width-30" maxlength="50"
					cssErrorClass="input-error width-30">
					<form:option value="C">A</form:option>
					<form:option value="C">C</form:option>
					<form:option value="T">P</form:option>
					<form:option value="S">T</form:option>
					<form:option value="B">S</form:option>
				</form:select>
				<form:errors path="codice" cssClass="error"></form:errors>
			</p>
			
			<p class="forms-inline">
				<form:label path="nome" cssErrorClass="error">Descrizione breve <em class="req">*</em></form:label>
				<form:input path="nome" cssClass="width-30" maxlength="50"
					cssErrorClass="input-error width-30" />
				<form:errors path="nome" cssClass="error"></form:errors>
			</p>
			
			<p class="forms-inline">
				<form:label path="azienda.nome" cssErrorClass="error">Azienda erogante <em class="req">*</em></form:label>
				<form:input path="azienda.nome" cssClass="width-30" maxlength="50"
					cssErrorClass="input-error width-30" />
				<form:errors path="azienda.nome" cssClass="error"></form:errors>
			</p>
			
			<c:if test="${opportunita.aziendaToBeDefined == false && opportunita.aziendaNotDefined == false && not empty opportunita.azienda.nome}">
				<p class="forms-inline">
					<form:label path="azienda.indirizzoCompleto" cssErrorClass="error">Indirizzo Azienda</form:label>
					<form:input path="azienda.indirizzoCompleto" cssClass="width-30" maxlength="100" />
				</p>
			</c:if>
			<c:if test="${opportunita.aziendaToBeDefined == true}">
				<p class="forms-inline">
					<form:label path="azienda.idAzienda" cssErrorClass="error">Indirizzo Azienda <em class="req">*</em></form:label>
					<form:select path="azienda.idAzienda" cssClass="width-30" cssErrorClass="input-error width-30">
						<form:options items="${aziendePossibili}" itemValue="idAzienda" itemLabel="indirizzoCompleto" />
					</form:select>
				</p>
			</c:if>
			
			<p align="right">
				<input type="reset" class="btn" value="Annulla">
				<c:if test="${opportunita.aziendaNotDefined == false }">
					<input type="hidden" name="_eventId" value="saveDatiOpportunita" >
					<input type="submit" class="btn" value="Salva">
				</c:if>
				<c:if test="${opportunita.aziendaNotDefined == true }">
					<input type="hidden" name="_eventId" value="definisciAziendaOpportunita" >
					<input type="submit" class="btn" value="Avanti">
				</c:if>
				
			</p>
		</form:form>
	</div>
</div>

